package com.flitsneak.rocket.consumer;

import com.flitsneak.common.entity.Info;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * @author flitsneak
 * @email flitsneak@gmail.com
 * @date 2022/8/10 14:47
 * @description
 */
@Slf4j
@Component
//@RocketMQMessageListener(topic = "topic1",consumerGroup = "group1",selectorExpression = "tag1 || tag2")
//@RocketMQMessageListener(topic = "topic1",consumerGroup = "group1",selectorType = SelectorType.SQL92 ,selectorExpression = "times > 2",messageModel = MessageModel.BROADCASTING)
@RocketMQMessageListener(topic = "topic1",consumerGroup = "group1",selectorExpression = "*",messageModel = MessageModel.CLUSTERING,consumeMode = ConsumeMode.ORDERLY)
public class RocketConsumer implements RocketMQListener<Info> {

    @Override
    public void onMessage(Info info) {
        log.info("rocket收到消息：{}",info);
    }
}